/**
 * fulihui.com Inc.
 * Copyright (c) 2015-2016 All Rights Reserved.
 */
package com.fulihui.integral.core.biz.conv;

import com.fulihui.integral.core.dal.dataobj.ISUserMonthStat;
import com.fulihui.integral.core.dto.ISUserMonthStatDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 用户按月积分统计 转换工具类
 * @author zhangyingjie
 * @version $Id: v 0.1 2017年04月14日 17:20 zhangyingjie Exp $
 */
public class ISUserMonthStatConvert {
    /**
     * 不copy的属性数组
     */
    private static final String[] ignoreProperties = {};

    /**
     * DTO转换成DO
     *
     * @param source
     * @return
     */
    public static ISUserMonthStat convertDTO2DO(ISUserMonthStatDTO source) {
        if (source == null) {
            return null;
        }
        ISUserMonthStat target = new ISUserMonthStat();
        BeanUtils.copyProperties(source, target);
        return target;
    }

    /**
     * DO转换成DTO
     *
     * @param source
     * @return
     */
    public static ISUserMonthStatDTO convertDO2DTO(ISUserMonthStat source) {
        if (source == null) {
            return null;
        }
        ISUserMonthStatDTO target = new ISUserMonthStatDTO();
        BeanUtils.copyProperties(source, target);
        return target;
    }

    /**
     * doList转换为dtoList
     * @param list
     * @return
     */
    public static List<ISUserMonthStatDTO> convert2List(List<ISUserMonthStat> list) {
        return list.stream().map(ISUserMonthStatConvert::convertDO2DTO).collect(Collectors.toList());

    }
    /**
     * dtoList转换为doList
     * @param list
     * @return
     */
    public static List<ISUserMonthStat> convertdto2doList(List<ISUserMonthStatDTO> list) {
        return list.stream().map(ISUserMonthStatConvert::convertDTO2DO)
                .collect(Collectors.toList());
    }
}
